package org.lgiavedoni.android.franq.sync;

import org.lgiavedoni.android.franq.core.calendar.RegisterCalendarEvent;
import org.lgiavedoni.android.franq.core.envent.Event;
import org.lgiavedoni.android.franq.core.sync.AbstractSyncProcess;
import org.lgiavedoni.android.franq.core.sync.Synchronizable;
import org.lgiavedoni.android.franq.service.phone.calendar.CalendarService;

public class EventsSyncProcess extends AbstractSyncProcess {

	@Override
	public boolean init() {
		return true;
	}

	@Override
	public boolean syncronizeObj(Synchronizable obj) {
		if (obj instanceof RegisterCalendarEvent) {
			CalendarService.inst.addCalendarEvent(((RegisterCalendarEvent) obj).toCalendarEvent());
			return true;
		}
		return false;
	}

	@Override
	protected void resetInternal() {
		CalendarService.inst.removeAllCalendarEvents();
	}

	@Override
	public Class getObjectClass() {
		return Event.class;
	}

}
